#
#
#


include ../Makefile.${THIS_SYSTEM}

LIBRARY=common.so
INCLUDES = -I.

ALL:START LIBRARY END

clean:
	rm -f core
	rm -f *.o
	rm -f ${LIBRARY}

THREAD_POOL_SRC = ThreadManager.C \
	  WorkThread.C \
	  BaseJob.C \
	  JobA.C \
	  JobB.C \
	  Mutex.C \
	  Condition.C \
	  Semaphore.C

LOGS_SRC = FileAdapter.C \
		   LogManager.C \
		   BaseLogAdapter.C \
		   ScreenAdapter.C \
		   SHMLogAdapter.C

EXCEPTION_SRC = Exception.C

FILE_SRC = File.C

SOCKS4PROXY_SRC = Socks4Proxy.C \
			  Socks4Client.C \
			  Socks4Server.C \
			  Socks4Util.C \
			  NetCDR.C \
			  NixTimer.C

ACTIVEOBJECT_SRC = ActiveObject.C

UTIL_SRC = StrStream.C Queue.C BaseQueueMsg.C \
		   FileMsg.C \
		   TimeVal.C \
		   SocketHdl.C \
		   Socket.C \
		   UDPSocket.C \
		   TCPSocket.C \
		   SocketHandleBase.C \
		   SocketHandle.C \
		   TCPServer.C \
		   NetAddr.C \
		   Node.C \
		   PropertyPair.C \
		   Properties.C \
		   Parser.C \
		   StrUtil.C


THREAD_POOL_OBJECTS = $(THREAD_POOL_SRC:.C=.o)
LOGS_OBJECTS = $(LOGS_SRC:.C=.o)
EXCEPTION_OBJECTS = ${EXCEPTION_SRC:.C=.o}
FILE_OBJECTS = ${FILE_SRC:.C=.o}
SOCKS4PROXY_OBJECTS = ${SOCKS4PROXY_SRC:.C=.o}
ACTIVEOBJECT_OBJECTS = ${ACTIVEOBJECT_SRC:.C=.o}
UTIL_OBJECTS = ${UTIL_SRC:.C=.o}


START:
	@echo "Compile start...";
END:
	@echo "End Compile...";
	

# log adapter 
FileAdapter.o : FileAdapter.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c FileAdapter.C
BaseLogAdapter.o : BaseLogAdapter.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c BaseLogAdapter.C
LogManager.o : LogManager.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c LogManager.C
ScreenAdapter.o : ScreenAdapter.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c ScreenAdapter.C
SHMLogAdapter.o : SHMLogAdapter.C
	 $(CC) $(CC_FLAGS) ${INCLUDES} -c SHMLogAdapter.C

# thread pool 
ThreadManager.o : ThreadManager.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c ThreadManager.C
WorkThread.o : WorkThread.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c WorkThread.C
BaseJob.o : BaseJob.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c BaseJob.C
JobA.o : JobA.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c JobA.C
JobB.o : JobB.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c JobB.C
Mutex.o : Mutex.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Mutex.C
Condition.o : Condition.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Condition.C
Semaphore.o : Semaphore.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Semaphore.C

# exception 
Exception.o : Exception.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Exception.C

# file
File.o : File.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c File.C

StrStream.o : StrStream.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c StrStream.C
BaseQueueMsg.o : BaseQueueMsg.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c BaseQueueMsg.C
FileMsg.o : FileMsg.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c FileMsg.C
Queue.o : Queue.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Queue.C

TimeVal.o : TimeVal.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c TimeVal.C
SocketHdl.o : SocketHdl.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c SocketHdl.C
Socket.o : Socket.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Socket.C
UDPSocket.o : UDPSocket.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c UDPSocket.C
TCPServer.o : TCPServer.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c TCPServer.C
TCPSocket.o : TCPSocket.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c TCPSocket.C
SocketHandleBase.o : SocketHandleBase.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c SocketHandleBase.C
SocketHandle.o : SocketHandle.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c SocketHandle.C
NetAddr.o : NetAddr.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c NetAddr.C

Node.o : Node.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Node.C
PropertyPair.o : PropertyPair.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c PropertyPair.C
Properties.o : Properties.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Properties.C
StrUtil.o : StrUtil.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c StrUtil.C
Parser.o : Parser.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Parser.C

	
# socks4 proxy
Socks4Proxy.o : Socks4Proxy.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Socks4Proxy.C
Socks4Client.o : Socks4Client.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Socks4Client.C
Socks4Server.o : Socks4Server.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Socks4Server.C
Socks4Util.o : Socks4Util.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c Socks4Util.C
NetCDR.o : NetCDR.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c NetCDR.C
NixTimer.o : NixTimer.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c NixTimer.C

# active object
ActiveObject.o : ActiveObject.C
	$(CC) $(CC_FLAGS) ${INCLUDES} -c ActiveObject.C


LIBRARY : ${THREAD_POOL_OBJECTS} ${LOGS_OBJECTS} ${EXCEPTION_OBJECTS} ${FILE_OBJECTS} ${SOCKS4PROXY_OBJECTS} ${ACTIVEOBJECT_OBJECTS} ${UTIL_OBJECTS}
	$(CC) $(CC_FLAGS) ${INCLUDES} -o $(LIBRARY) $(LD_FLAGS) \
		${THREAD_POOL_OBJECTS} \
		${LOGS_OBJECTS} \
		${EXCEPTION_OBJECTS} \
		${FILE_OBJECTS}	\
		${SOCKS4PROXY_OBJECTS} \
		${ACTIVEOBJECT_OBJECTS} \
		${UTIL_OBJECTS}

